﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace FriendsContactWeb
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        DataClass dataClass = null;
        int messagesCount = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Page.User.Identity.IsAuthenticated)
                {
                    dataClass = new DataClass(Page.User.Identity.Name);
                    messagesCount = dataClass.GetMessagesForUser(Page.User.Identity.Name).Count;
                    if (messagesCount > 0)
                    {
                        this.NavigationMenu.Items[1].Text += " (" + messagesCount.ToString() + ")";
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }

    }
}
